#pragma once
#include <stdexcept>

namespace krryn{
namespace gui{
	class widget_exception : public std::runtime_error{
	public:
		widget_exception(const std::string &a_Error) : runtime_error(a_Error) {}
	};

	class widget{
	public:
		typedef widget *ptr;

		virtual void *handle() = 0;
	};

	template<typename _Super>
	class widget_initializer{
	public:
		widget_initializer()
			: m_Top(0), m_Left(0), m_Width(100), m_Height(100) {}

		_Super &top(unsigned int a_Top){
			m_Top = a_Top;
			return static_cast<_Super&>(*this);
		}

		_Super &left(unsigned int a_Left){
			m_Left = a_Left;
			return static_cast<_Super&>(*this);
		}

		_Super &width(unsigned int a_Width){
			m_Width = a_Width;
			return static_cast<_Super&>(*this);
		}

		_Super &height(unsigned int a_Height){
			m_Height = a_Height;
			return static_cast<_Super&>(*this);
		}

		unsigned int m_Top, m_Left, m_Width, m_Height;
	};
}
}